package com.geekstudy.week3.service;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import java.util.LinkedHashMap;
import java.util.Map;

@Service
@Path("/demo")
public class JerseyDemoService {

    final Logger logger = LoggerFactory.getLogger(JerseyDemoService.class);

    @POST
    @Produces("application/json")
    public Map<String, String> demoGet(@QueryParam(value = "demo") String demo) {
        logger.info("demoGet demo:{} ", demo);
        Map<String, String> resultMap = new LinkedHashMap<String, String>();

        resultMap.put("requestId", String.valueOf(System.nanoTime()));
        resultMap.put("demo", demo);

        return resultMap;
    }
}
